<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <!-- <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" /> -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/backstage/css/font.css">
    <link rel="stylesheet" href="/backstage/css/xadmin.css">
    <!-- <link rel="stylesheet" href="http://unpkg.com/iview/dist/styles/iview.css"> -->
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body >
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">管理员管理</a>
        <a>
          <cite>管理员回收站</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body" id='admin'>
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
          <input class="layui-input" placeholder="开始日" name="start" id="start" >
          <input class="layui-input" placeholder="截止日" name="end" id="end" >
          <input type="text" name="seach_text"  placeholder="输入内容搜索" id='seach_text' class="layui-input" >
          <button class="layui-btn"  lay-submit="" lay-filter="sreach" type="button" @click="seachData"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <div>
        <button class="layui-btn layui-btn-danger" onclick="delAll('{:config(\'template.root_path\')}/admin/delete?is_sure=1')"><i class="layui-icon"></i>批量删除</button>
        <!--<button class="layui-btn" onclick="restoreAll('{:config(\'template.root_path\')}/admin/restore')"><i class="layui-icon">&#xe9aa;</i>  批量还原</button>-->
        <a href="{:config('template.root_path')}/admin"><button class="layui-btn">返回列表</button></a>

        <span class="x-right" style="line-height:40px">共有数据：{{pageData.count}} 条</span>
      </div>
      <table class="layui-table">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            <th>ID</th>
            <th>登录名</th>
            <th>角色</th>
            <th>手机号码</th>
            <th>邮箱</th>
            <!--<th>状态</th>-->
            <th>删除时间</th>
            <th>创建时间</th>
            <th>操作</th>
        </thead>
        <tbody  >
          <tr  v-for="(item,index) in adminData" >
            <td>
              <div class="layui-unselect layui-form-checkbox" onclick="checkThis(this)" lay-skin="primary" :data-id='item.id'><i class="layui-icon">&#xe605;</i></div>
            </td>
            <td>{{item.id}}</td>
            <td>{{item.name}}</td>
            <td>{{item.role_name}}</td>
            <td>{{item.phone}}</td>
            <td>{{item.email}}</td>
            <!--<td>-->
                <!--&lt;!&ndash; <td class="td-status">-->
                    <!--<span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span></td>-->
                  <!--<td class="td-manage"> &ndash;&gt;-->
                <!--<button v-if="item.status==1" class="layui-btn layui-btn-sm layui-btn-normal">启用中</button>-->
                <!--<button v-else class="layui-btn layui-btn-warm layui-btn-sm">已禁用</button>-->
            <!--</td>-->
            <td>{{item.delete_time}}</td>
            <td>{{item.create_time}}</td>
         
            <td class="td-manage">
              <a @click="restore(item.id)"  href="javascript:;"  title="还原">
                  <i class="layui-icon">&#xe9aa;</i>
              </a>

              <a title="彻底删除" @click="admin_delete(item.id)" href="javascript:;">
                <i class="layui-icon">&#xe640;</i>
              </a>
            </td>
          </tr>
          <tr v-if="adminData.length<1"><td colspan='10' style="text-align:center">暂无数据</td></tr>
        </tbody>
      </table>
      <div style="text-align:center">
        <!-- <div>
          <a class="prev" href="">&lt;&lt;</a>
          <a class="num" href="">1</a>
          <span class="current">2</span>
          <a class="num" href="">3</a>
          <a class="num" href="">489</a>
          <a class="next" href="">&gt;&gt;</a>
        </div> -->
        <div  v-if="adminData.length>0" id="page"></div>
      </div>
    </div>

    <!-- import iView -->
    
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/vue.js"></script>
    <!-- <script src="http://unpkg.com/iview/dist/iview.min.js"></script>     -->
    <script type="text/javascript" src="/backstage/js/xadmin.js"></script>
    <script type="text/javascript" src="/backstage/lib/layui/layui.js" ></script>
    
    <script>

      var app = new Vue({
        el:'#admin',
        data: {
          adminData:[],
          pageData:{
            page:1,
            count:10,
            pageSize:10,
            start: '',
            end: '',
            seach_text: ''
          }
        },
        methods: {
          reverseMessage: function () {
            this.message = this.message.split('').reverse().join('')
          },

          //获取列表
          getListData: function () {
            load();
            var that = this;
            $.get('recycle',that.pageData,function(res){
              layer.closeAll();
              if(res.code==200){
            
                that.adminData = res.adminData;
                that.pageData.page = res.pageData.page;
                that.pageData.count = res.pageData.count;
                that.pageData.pageSize = res.pageData.pageSize;
                if(res.pageData.page==1){
                  page(that.pageData);
                }
              }else{
                layer.msg(res.msg,{icon:5,time:1000});
              }
            },'json');
          },

          //分页
          page:function(){
            var that = this;
            setTimeout(function(){
                page(that.pageData);
            },100)
          },

          //删除
          admin_delete:function(id){
            var that = this;
            layer.confirm('确认要删除吗？',{title:''},function(index){
              $.post('{:config("template.root_path")}/admin/delete',{id:id,is_sure:1},function(msg){
              if(msg.code==200){
                layer.msg('已删除!',{icon:1,time:1000});
                that.getListData();
              }else{
                layer.msg(res.msg,{icon:5,time:1000});
              }
            },'json')
           });
          },
          //删除
          restore:function(id){
              var that = this;

              $.post('{:config("template.root_path")}/admin/restore',{ids:id},function(msg){
                  if(msg.code==200){
                      layer.msg('已还原!',{icon:1,time:1000});
                      that.getListData();
                  }else{
                      layer.msg(res.msg,{icon:5,time:1000});
                  }
              },'json')

          },

            //搜索
          seachData:function(){
            this.pageData.page = 1;
            this.pageData.end = $('#end').val();
            this.pageData.start = $('#start').val();
            this.pageData.seach_text = $('#seach_text').val();
            this.getListData();
          },
        },
        created: function () {
          this.getListData();
        }
      })
      
     layDate();

    
    </script>
  
  </body>

</html>